/*
 * variableEtFonction.c
 *
 *  Created on: 5 déc. 2011
 *      Author: arthur
 */

#include <stdio.h>
#include "variableEtFonction.h"

void afficherVariable(variable * var) {
	printf("id= %d, ", var->numeroVariableTemporaire);
	if (var->dimenssions > 0) {
		printf("tableau de ");
	}

	switch (var->type) {
	case unit:
		printf("unit");
		break;
	case bool:
		printf("bool");
		break;
	case integer:
		printf("int");
		break;
	case array:
		printf("array (erreure)");
		break;
	default:
		printf("type inconnu");
		break;
	}

	if (var->dimenssions > 0) {
		printf(" à %d dimenssion(s)\n", var->dimenssions);
		int i;
		for (i = 0; i < var->dimenssions; i++) {
			printf("\t\t\tdimenssions %d borne inf : %d et borne sup %d\n", i,
					var->bornesInf[i], var->bornesSup[i]);
		}
	} else {
		printf("\n");
	}
}
void afficherFonction(fonction * fct) {
	switch (fct->retour) {
	case unit:
		printf("unit");
		break;
	case bool:
		printf("bool");
		break;
	case integer:
		printf("int");
		break;
	case array:
		printf("array");
		break;
	default:
		printf("type inconnu");
		break;
	}
	printf(" %s(", fct->label);
	int i;
	for (i = 0; i < fct->nbArgs; i++) {
		switch (fct->typeArgs[i]) {
		case unit:
			printf(" unit,");
			break;
		case bool:
			printf(" bool,");
			break;
		case integer:
			printf(" int,");
			break;
		case array:
			printf(" array,");
			break;
		default:
			printf(" type inconnu,");
			break;
		}
	}

	printf(")\n");
}
